package com.yjt.fresh.adpater;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yjt.fresh.R;
import com.yjt.fresh.bean.BeanAddress;
import com.yjt.fresh.bean.BeanExpress;

import java.util.List;

import butterknife.BindView;

/**
 *
 * Created by mcc on 2018/6/10.
 */

public class AdpRvExpress extends BaseQuickAdapter<BeanExpress.ExpressListBean, BaseViewHolder> {


    private final List<BeanExpress.ExpressListBean> mData;

    public AdpRvExpress(int layoutResId, @Nullable List<BeanExpress.ExpressListBean> data) {
        super(layoutResId, data);
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanExpress.ExpressListBean item) {
        TextView mTvDate = helper.getView(R.id.tvAppRecycleItemAtyExpressDate);

        TextView mTvTime = helper.getView(R.id.tvAppRecycleItemAtyExpressTime);
        View mVHead = helper.getView(R.id.vAppRecycleItemAtyExpressHead);

        View mVContent = helper.getView(R.id.vAppRecycleItemAtyExpressContent);

        TextView mTvStatus = helper.getView(R.id.tvAppRecycleItemAtyExpressStatus);

        TextView mTvContent = helper.getView(R.id.tvAppRecycleItemAtyExpressContent);

        String[] times = item.getTime().split(" ");
        mTvDate.setText(times[0]);
        mTvTime.setText(times[1]);
        mTvContent.setText(item.getStatus());

        if (helper.getAdapterPosition() == 0){
            mVHead.setBackgroundResource(R.drawable.shape_43b624);
            int color = mContext.getResources().getColor(R.color.color_43b624);
            mVContent.setBackgroundColor(color);
            mTvDate.setTextColor(color);
            mTvContent.setTextColor(color);
            mTvTime.setTextColor(color);
        }else {
            mVHead.setBackgroundResource(R.drawable.shape_cdcdcd);
            mVContent.setBackgroundColor(mContext.getResources().getColor(R.color.color_CDCDCD));
        }

    }
}
